﻿//------------------------------------------------------------------------------
// Written for CP2011 Project @ JCU, 2011
// By Drewan O'Brien
//
// Returns a Transaction object depending on the protocolString.Directive 
//------------------------------------------------------------------------------

using System;

namespace BluSteamServer.Model.TransactionImplementation
{
    public class TransactionFactoryImplementation : TransactionFactory
    {
        public Transaction MakeTransaction(ProtocolData protocolString)
        {
            switch (protocolString.Directive)
            {
                case "LOGIN":
                    return new LoginTransaction(protocolString.UserName, protocolString.Password);

                case "CHANGE_PASSWORD":
                    //return new ChangePassword(data[username], null, data[newPassword]);

                case "SEND_MESSAGE":
                    //return new ChatTransaction(data[username], data[message], data[recipient]);

                case "REGISTER":
                    return new RegisterTransaction(protocolString.UserName, protocolString.Email, protocolString.Password);

                default:
                    break;
            }
            return null;
        }
    }
}
